home *** CD-ROM | disk | FTP | other *** search
- 10 REM *************************************************************
- 20 REM ** ANSI-RIP ANSI control code stripper, by Monte Ferguson **
- 30 REM ** Vers 1.0, written 22-Jan-87 **
- 40 REM *************************************************************
- 100 CLS:KEY OFF
- 110 PRINT "ANSI-RIP - ANSI control code stripper":PRINT
- 120 PRINT "This program will strip the ANSI control codes from a document.
- 130 PRINT
- 200 PRINT " Please enter the name of the source file. Note that the source file"
- 210 PRINT "will be unchanged... press just ENTER to abort."
- 220 INPUT "Source File";SOURCE$:IF SOURCE$="" THEN PRINT "-aborted by user-":STOP
- 300 PRINT
- 310 PRINT " Please enter the file or device name that you want to result to be"
- 320 PRINT "written to. Again, press only ENTER to abort."
- 330 INPUT "Target";TARGET$:IF TARGET$="" THEN PRINT "-aborted by user-":STOP
- 400 PRINT:PRINT:PRINT
- 410 PRINT "Openning Source file...";
- 420 OPEN SOURCE$ FOR INPUT AS #1:PRINT "opened."
- 430 L=LOF(1):PRINT "There are";L;"bytes in this file."
- 440 IF L=0 THEN PRINT "There doesn't seem to be much to strip, does there ?!":STOP
- 450 PRINT
- 500 PRINT "Openning Target...";
- 510 OPEN TARGET$ FOR OUTPUT AS #2:PRINT "opened."
- 600 CL=0:CB=1
- 610 WHILE NOT EOF(1)
- 620 LINE INPUT #1,A$
- 630 CL=CL+1:CB=CB+LEN(A$)+2:IF CL/10=INT(CL/10) THEN LOCATE 20,1:PRINT "Lines:";CL;TAB(20);"Bytes:";CB;TAB(40);INT(100*(CB/L));"% done. "
- 700 WHILE INSTR(A$,CHR$(27))>0
- 710 I=INSTR(A$,CHR$(27)):J=I+1
- 720 IF INSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",MID$(A$,J,1))>0 THEN 800
- 730 J=J+1:IF J>LEN(A$) THEN J=I ELSE 720
- 800 A$=LEFT$(A$,I-1)+MID$(A$,J+1)
- 810 WEND
- 820 PRINT #2,A$
- 900 WEND:LOCATE 20,1:PRINT "Lines:";CL;TAB(20);"Bytes:";CB;TAB(40);INT(100*(CB/L));"% done. ":END